import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../views/Layout/Layout.vue'
import Login from '../views/Login/Login.vue'
import Home from '../views/Home/Home.vue'
import Virtualphone from '@/views/Virtualphone/Virtualphone.vue'
import Role from '@/views/Role/Role.vue'
import Sysuser from '@/views/Sysuser/Sysuser.vue'
import User from '@/views/User/User.vue'
import Billing from '@/views/Billing/Billing.vue'
import CallHistory from '@/views/CallHistory/CallHistory.vue'
import Business from '@/views/User/Business.vue'
import PayResult from '@/views/PayResult/PayResult.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login',
    },
    {
      path: '/login',
      name: 'login',
      component: Login,
    },
    {
      path: '/pay-result',
      name: 'payResult',
      component: PayResult,
    },
    {
      path: '/main',
      component: Layout,
      children: [
        {
          path: '',
          name: 'home',
          component: Home,
        },
        {
          path: 'sysuser',
          name: 'sysuser',
          component: Sysuser,
        },
        {
          path: 'user',
          name: 'user',
          component: User,
        },
        {
          path: 'business',
          name: 'business',
          component: Business,
        },
        {
          path: 'virtualphone',
          name: 'virtualphone',
          component: Virtualphone,
        },
        {
          path: 'role',
          name: 'role',
          component: Role,
        },
        {
          path: 'billing',
          name: 'billing',
          component: Billing,
        },
        {
          path: 'history',
          name: 'history',
          component: CallHistory,
        },
      ],
    },
  ],
})

export default router
